﻿using UtilZ.Dotnet.Ex.Model;

namespace UtilZ.Dotnet.Ex.Communication.Net.BMQ
{
    /// <summary>
    /// BMQ消息接口
    /// </summary>
    public interface IBMQMessage
    {
        /// <summary>
        /// BMQ消息类型
        /// </summary>
        byte MessageType { get; }

        /// <summary>
        /// 消息生成进二进制buffer
        /// </summary>
        /// <param name="buffer">二进制buffer</param>
        void ToBytes(ArraySpan<byte> buffer);

        /// <summary>
        /// 消息生成进TLV二进制buffer
        /// </summary>
        /// <param name="buffer">二进制buffer</param>
        void ToTLVBytes(ArraySpan<byte> buffer);

        /// <param name="data">完整消息数据</param>
        void FromBytes(ArraySpan<byte> data);

        /// <summary>
        /// 关闭缓冲区
        /// </summary>
        void Close();

    }
}
